/***************************************************************************
 *   Copyright (C) 2008 by Eduardo Gurgel Pinho                            *
 *   edgurgel@gmail.com                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/

#ifndef __RAYTRACER_PANEL_H__
#define __RAYTRACER_PANEL_H__

#include <QWidget>
#include "raytracing/raytracer.h"
#include "photonmapping/photontracer.h"

class QLabel;
class QMouseEvent;
class QSpinBox;
class QCheckBox;
class QGroupBox;

namespace Ui {

class Raytracer_Panel : public QWidget {

Q_OBJECT

public:
	Raytracer_Panel(QWidget*,Sirat::Ray_Tracing::Raytracer*);
	~Raytracer_Panel(void);

	QSize minimumSizeHint() const;
	
	Sirat::Ray_Tracing::Raytracer* get_raytracer(void) const;
	Sirat::Photon_Mapping::Photontracer* get_photontracer(void) const;
	unsigned int get_sample_photons(void) const;
	
	void set_raytracer(Sirat::Ray_Tracing::Raytracer*);

private slots:
	void direct_illumination_changed(int);
	void indirect_illumination_changed(int);
	void soft_shadow_changed(int);
	void depth_changed(int);
	void sample_rays_changed(int);
	void shadow_rays_changed(int);
	
	void parallel_changed(int);
	void num_threads_changed(int);
	
	void photon_mapping_changed(int);
private:
	
	QGroupBox* create_rendering_groupbox(void);
	QGroupBox* create_montecarlo_groupbox(void);
	QGroupBox* create_photon_mapping_groupbox(void);
	
	Sirat::Ray_Tracing::Raytracer* raytracer;
	
	bool photon_mapping;
	unsigned int sample_photons;
		
	QCheckBox* direct_illumination_checkbox;
	QCheckBox* indirect_illumination_checkbox;
	QCheckBox* soft_shadow_checkbox;
	QCheckBox* photon_mapping_checkbox;
	QSpinBox* depth_spinbox;
	QSpinBox* sample_rays_spinbox;
	QSpinBox* shadow_rays_spinbox;
	QSpinBox* num_photons_spinbox;
	QSpinBox* sample_photons_spinbox;
	// OpenMP
	QCheckBox* parallel_checkbox;
	QSpinBox* num_threads_spinbox;
	
};

}

#endif
